def every_n_seconds(n)
 loop do
   yield
   sleep(n)
 end
end

every_n_seconds(5) do

 puts "At the beep, the time will be #{Time.now.strftime("%X")}... beep!"
end